package com.graduation.rescuematerial.controller;

import com.graduation.rescuematerial.service.UserService;
import com.graduation.rescuematerial.vo.LoginVo;
import com.graduation.rescuematerial.vo.RespBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @Author:CaiShuangLian
 * @FileName:
 * @Date:Created in  2022/4/13 20:37
 * @Version:
 * @Description:TODO
 */
@RestController
@RequestMapping("/login")
@Api(tags = "登录模块")
public class LoginController {

    @Autowired
    private UserService userService;

    @ApiOperation("登录（返回所有信息，包含部门信息和权限信息）")
    @PostMapping("/doLogin")
    @ResponseBody
    public RespBean doLogin(@Valid @RequestBody LoginVo loginVo, HttpServletRequest request, HttpServletResponse response){
        return userService.doLogin(loginVo,request,response);
    }

}
